<%--
  Created by IntelliJ IDEA.
  User: acer
  Date: 2024/9/19
  Time: 10:16
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
    <title>网上调查步骤之三</title>
</head>
<body>
<%@include file="tom.html"%>
<%
    String namesex = (String)session.getValue("namesex");
    String hoddy[] = new String[5];
    for (int i = 0;i< hoddy.length;i ++){
        // new数组中存储了受访者的选择
        String param = "hoddy"+i;
        String getparam = request.getParameter(param);
        if (getparam != null){
            hoddy[i] = new String(getparam.getBytes("ISO-8859-1"),"UTF-8");
            synchronized (application){
                Integer count = (Integer) application.getAttribute(param);
                if (count == null)
                    count = new Integer(0);
                count = new Integer(count.intValue()+1);
                application.setAttribute(param,count);
            }
        }
    }
%>
<p>
    <%=(String) session.getValue("namesex")%>
    ，你所感兴趣的业余爱好如下：
</p>
<%
    for (int i=0;i < hoddy.length;i ++)
        if (hoddy[i] != null){
            out.print("<P>");
            out.println(hoddy[i]);
            out.println("</p>");
        }
    String hoddyname[] = {"电影欣赏","阅读书籍","体育运动","户外旅游","流行音乐"};
    for (int i = 0;i< hoddy.length;i ++){
        Integer dount = (Integer) application.getAttribute("hoddy"+i);
        if (count == null)
            count = new Integer(0);
        out.println("<P>选择"+hoddyname[i]+"的人次为"+"</p>");
    }
%>
</body>
</html>
